package com.ruoyi.hqfinance.controller;

import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.domain.vo.TableVo;
import com.ruoyi.common.service.TableService;
import com.ruoyi.hqfinance.domain.HqNetworkBillVerify;
import com.ruoyi.hqfinance.domain.HqPaidFlowSheet;
import com.ruoyi.hqfinance.domain.vo.HqNetworkBillVerifyVo;
import com.ruoyi.hqfinance.domain.vo.HqPaidFlowSheetVo;
import com.ruoyi.hqfinance.service.HqNetworkBillVerifyService;
import com.ruoyi.hqfinance.service.HqPaidFlowSheetService;
import com.ruoyi.logistic.domain.PageInfo;
import com.ruoyi.logistic.utils.TableUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/hq/paidFlowSheet")
@Api(tags = "总部财务-有偿流量流向报表")
public class HqPaidFlowSheetController {
    @Autowired
    private HqPaidFlowSheetService hqPaidFlowSheetService;
    @Autowired
    private TableService tableService;

    @ApiOperation("报表汇总")
    @PostMapping("/collect")
    public R collect(@RequestBody HqPaidFlowSheetVo vo){
        if (vo.getStartWeight() == 0 && vo.getEndWeight() == 0){
            vo.setStartWeight(0.00);
            vo.setEndWeight(999.99);
        }
        List<HqPaidFlowSheet> list = hqPaidFlowSheetService.collect(vo);
        List<TableVo> fieldList = tableService.getFieldAnnotation(new HqPaidFlowSheet());
        return TableUtils.handleListResponse(list, fieldList, "暂无数据");

    }
}
